#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QWidget>
#include <QAction>
#include "dataitemdef.h"
#include "mainboardreceiver.h"

class QToolBar;
class QPushButton;
class QStatusBar;
class QVBoxLayout;
class QStackedLayout;
class CLogWidget;
class CSysStatusWidget;
class CCoviewDataReceiver;
class CMainBoardReceiver;
class CMyIconLabelWidget;

class MainWindow : public QWidget
{
    Q_OBJECT

public:
    MainWindow(QWidget *parent = nullptr);
    ~MainWindow();
    void AddLogMessage( QString strMsg );
    CMainBoardReceiver * GetMainboardReceiver(){ return m_pMainBoardReceiver; }

protected:
    void CreateToolbarActions();
    void CreateActions();
    void CreateCloseButton();
    void CreateStatusBar();
    void CreateLogWidget();
    void CreateRenderWidgets();
    void CreateMeasureActions();
    void CreateCoViewDataRecevier();
    void CreateMainBoardReceiver();

protected slots:
    void slot_SystemSetup();
    void slot_ShowRuntimeLog();
    void slot_Measure_10MHz(TMB_10MHz);
    void slot_Measure_TTL(TMB_SIGTIE);
    void slot_Measure_RS422(TMB_TOD_BDC_BAC);
    void slot_Measure_ToD(TMB_TOD_BDC_BAC);
    void slot_Measure_BAC(TMB_TOD_BDC_BAC);
    void slot_Measure_NTP(TMB_NTP_PTP );
    void slot_Measure_PTP(TMB_NTP_PTP);
    void slot_Measure_2048KHz(TMB_SIGTIE);

    void slot_OnCoViewData( const COVIEW_DATAITEM& CoViewDataItem );
    void slot_GetDataFromMainboard();    
    void slot_SysInfoData( const TMB_SYSINFO& SysInfo );
    void slot_GetIOSBV( const TMB_IOSBV& IoSBV );



protected:
    virtual void resizeEvent( QResizeEvent * event );
    virtual void closeEvent( QCloseEvent * event );

protected:
    enum
    {
        ICON_WIDTH = 24,
    };
    enum
    {
        MAIN_WINDOW_WIDTH = 1024,
        MAIN_WINDOW_HEIGHT = 768
    };

protected:
    QAction                     *   m_pActionSetup = nullptr;
    QAction                     *   m_pActionShowLog = nullptr;
    QAction                     *   m_pActionMeasure_10MHz = nullptr;
    QAction                     *   m_pActionMeasure_TTL = nullptr;
    QAction                     *   m_pActionMeasure_RS422 = nullptr;
    QAction                     *   m_pActionMeasure_ToD = nullptr;
    QAction                     *   m_pActionMeasure_BAC = nullptr;
    QAction                     *   m_pActionMeasure_NTP = nullptr;
    QAction                     *   m_pActionMeasure_PTP = nullptr;
    QAction                     *   m_pActionMeasure_2048KHz = nullptr;

    QToolBar                    *   m_pToolbar = nullptr;
    QPushButton                 *   m_pBnClose = nullptr;
    QStatusBar                  *   m_pStatusBar = nullptr;
    CLogWidget                  *   m_pLogWidget = nullptr;

    CMyIconLabelWidget          *   m_pGnnsReceiverOnlineStatus = nullptr;
    CMyIconLabelWidget          *   m_pMainBoardOnlineStatus = nullptr;

    QVBoxLayout                 *   m_pMainLayout = nullptr;
    QStackedLayout              *   m_pRenderWidgetLayout = nullptr;
    CSysStatusWidget            *   m_pSysStatusWidget = nullptr;

    // 共视数据接收
    CCoviewDataReceiver         *   m_pCoViewDataReceiver = nullptr;
    // 测试主板接收对象
    CMainBoardReceiver          *   m_pMainBoardReceiver = nullptr;

    TMB_TOD_BDC_BAC             a;


};
#endif // MAINWINDOW_H
